package thread.test1Io;

import org.junit.Test;

import java.io.*;

/**
 *
 *  https://blog.csdn.net/jiangwei0910410003/article/details/22376895
 */

public class ReaderTest {


    @Test
    public void test1(){
        try {
            FileInputStream fin=new FileInputStream(new File("d:/a.txt"));
            BufferedReader reader=new BufferedReader(new InputStreamReader(fin,"utf-8"));
            int  a=0;
            while ((a=reader.read()) !=-1){
                System.out.println(a);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /**
     * 汉字中的中文编码
     * 11100100 10111000 10101101
     * 111001001011100010101101
     * -28 -72 -23
     */
    @Test
    public void test2(){
        String b="中";
        byte aa []=b.getBytes();
        System.out.println(new String(aa));
        long c=0;
        for(byte a:aa){
            System.out.println((c<<8)|a);
        }
    }
}
